package com.biomatch.matchlock;

import com.biomatch.context.SpringContainer;
import com.biomatch.mqtt.MqttClient;
import com.biomatch.mqtt.MqttClientConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Slf4j
@SpringBootApplication
@ComponentScan(value = {"com.*"})
@EnableConfigurationProperties
@EnableSwagger2
public class MatchLockApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext ctx = SpringApplication.run(MatchLockApplication.class);
        SpringContainer.createInstance().setApplicationContext(ctx);
//        connectEmq();
        log.info("lock system init successful");
    }

//    private static void connectEmq(){
//        MqttClientConfig mqttClientConfig = SpringContainer.getBean(MqttClientConfig.class);
//        MqttClient mqttClient = SpringContainer.getBean(MqttClient.class);
//        mqttClient.setMqttClientConfig(mqttClientConfig);
//        mqttClient.init();
//    }
}
